﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SharepointSolutionInstaller.Utils.Configuration;
using SharepointSolutionInstaller.Resources;

namespace SharepointSolutionInstaller.Views
{
    public partial class DetailsView : InstallerControl
    {
        public DetailsView()
        {
            InitializeComponent();
            this.Load += new EventHandler(CompletionControl_Load);
        }

        void CompletionControl_Load(object sender, EventArgs e)
        {
            // Conditionally show the FinishedControl
            if (InstallConfiguration.ShowFinishedControl && Form.operation == InstallOperation.Install)
            {
                DetailsView finishedControl = new DetailsView();
                finishedControl.Title = CommonUIStrings.finishedTitle;
                finishedControl.SubTitle = InstallConfiguration.FormatString(CommonUIStrings.finishedSubTitle);
                Form.contentControls.Add(finishedControl);
                Form.btnNext.Enabled = true;
            }
        }

        public string Details
        {
            get { return detailsTextBox.Text; }
            set { detailsTextBox.Text = value; }
        }

        protected internal override void Open(InstallOptions options)
        {
            Form.btnPrevious.Enabled = false;
            if (InstallConfiguration.ShowFinishedControl && Form.operation == InstallOperation.Install)
            {
                Form.btnCancel.Enabled = false;
            }
        }
    }
}